/**
 * Created by chenxiaojun on 16/10/12.
 */

let initRouters = [
  //首页
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: function (resolve) {
      require(['../views/index.vue'], resolve)
    },
    name: 'index'
  },
  {
    path: '/login',
    component: function (resolve) {
      require(['../views/login.vue'], resolve)
    },
    name: 'login'
  },
  {
    path: '/register',
    component: function (resolve) {
      require(['../views/register.vue'], resolve)
    },
    name: 'register'
  },
  {
    path: '/cv',
    component: function (resolve) {
      require(['../views/cv.vue'], resolve)
    },
    name: 'cv'
  },
  {
    path: '/list',
    component: function (resolve) {
      require(['../views/list.vue'], resolve)
    },
    name: 'list'
  },
  {
    path: '/forgetPass',
    component: function (resolve) {
      require(['../views/forgetPass.vue'], resolve)
    },
    name: 'forgetPass'
  },
  {
    path: '/forget',
    component: function (resolve) {
      require(['../views/forget.vue'], resolve)
    },
    name: 'forget'
  },
  {
    path: '/bindPass',
    component: function (resolve) {
      require(['../views/bindPass.vue'], resolve)
    },
    name: 'bindPass'
  }
];
var langs = ['zh', 'en'];

function registerRoute(initRouters) {
  let routersArr = [];
  langs.forEach((lang) => {
    initRouters.forEach((item) => {
      var cotyItem = Object.assign({}, item);
      // cotyItem.path = `/${lang}` + cotyItem.path;
      cotyItem.name = `${lang}` + cotyItem.name;
      routersArr.push(cotyItem);
    })
  })
  return routersArr;
}
var defaultPath = '/zh'
let routers = registerRoute(initRouters);
console.log(routers);
export default routers